<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>添加产品</title>
    <link rel="stylesheet" href="/static/lib/layuiadmin/plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/static/lib/layuiadmin/css/global.css" media="all">
    <link rel="stylesheet" href="/static/lib/layuiadmin/plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="/static/lib/layuiadmin/css/table.css" />
</head>

<body>
<div class="admin-main">

    <div style="margin: 15px;">
        <form class="layui-form" method="post" action="/admin/product/create">
            <div class="layui-form-item">
                <label class="layui-form-label">规格名称</label>
                <div class="layui-input-block">
                    <input type="text" name="sku" required lay-verify="required" placeholder="请输入规格名称" autocomplete="off" class="layui-input">
                </div>
            </div>


            <div class="layui-form-item">
                <div class="layui-input-block">
                    <a lay-filter="add" lay-submit class="layui-btn" id="submit">提交</a>
                </div>
            </div>
        </form>
    </div>

</div>
<script type="text/javascript" src="/static/lib/layuiadmin/plugins/layui/layui.js"></script>
<script type="text/javascript" src="/static/lib/ueditor/ueditor.config.js?v=1"></script>
<script type="text/javascript" src="/static/lib/ueditor/ueditor.all.js"></script>

<script type="text/javascript">

    layui.use(["layer","upload"],function(){
        var $ = layui.jquery;
        $("#submit").click(function(){
            var sku = $("input[name=sku]").val();
            if(!sku){
                alert('规格名称必填');
            }
            $.post('/admin/product_data/createSku',{sku:sku,productId:'<{$productId}>'},function(data){
                alert(data.msg);
                if('1' == data.code){
                    window.parent.location.reload();
                }
            });
        });
    });

</script>

</body>

</html>